<template>
  <div class="container-pt">
    <van-nav-bar left-arrow  @click-left="$router.back()" fixed title="我的点赞"/>
    <article-list :disable-swiper="false" :articles="mylike">
      <template #rights="{id}">
        <van-button square type="warning" text="取消" @click="cancel(id)" />
      </template>
    
    </article-list>
  </div>
</template>

<script>
import articleList from '@/components/article-list.vue'
import {getmylike} from '../../api/userinfo'
import {cancelit} from '../../api/cancel'
export default {
  components: { articleList },
  data() {
    return {
      active:0,
      params:{
        type:2,
        page:1,
        limit:10
      },
      mylike:[]
    };
  },

  methods:{
  async  dolikelist(){
    const res = await getmylike(this.params)
    console.log(res);
    this.mylike = res.data.list.data
    },
   async cancel(id){
      console.log(id);
      const params = {
        type: 2,
       action:'del',
        article_id:id
      }
      const res = await cancelit(params)
      console.log(res);
      if(res.errno===0){
        this.$toast.success('取消成功')}
       
        this.$router.go(0)
    } 

  }
};
</script>

<style>

</style>